Copyright: Sebastian Modersohn Softwaredevelopment


Contents of the SMWCC Pack
SMWCC 1.0

This is a shareware product. This allows you to try the software before you buy it. If after evaluating SMWCC, you decide to continue using it, you are required to register the software by remitting the registration fee of $15 to us.

See How to register for information on registering SMWCC.

The SMWCC (Sebastian-Modersohn's-Windows-Custom-Controls) consists of 4 custom controls which can be used with the Resource Workshop shipped with Borland Pascal and Borland C++:

PercentBar PBAR.DLL PCNT.PAS PCNTAPP.EXE	MicroScroll MICROS.DLL MICRO.PAS MICROSAP.EXE
MenuButton MBUTTONS.DLL MBUTTON.PAS MBAPP.EXE	Structo STRUCTOS.DLL STRUCTO.PAS STRUCTAP.EXE

Each control has got its own library (*.DLL, 1st filename), its own import unit (*.PAS, 2nd filename) and its own simple demo application (*.EXE, 3rd filename).

The unregistered version of SMWCC 1.0 has got some limitations:

-	the source code of the libraries and the interface units isn't included
-	you will see that the use of the unregistered controls inside the Resource Workshop isn't as comfortable as the use of the registered controls will be <G>.

How to install.

How to register.


The PercentBar Control

This control is a simple to use percent bar. You can choose if you want to have a Ctl3D-Frame or a normal ws_Border Frame. The background of the control is white, the filled percent bar will be blue. The control has got four methods to set the percent value and two methods to get this value. The XXXVal methods use a real value from 0 to 1, the XXXPercent methods use normal percent values from 0 to 100.

Methods:

AddVal

SetVal

GetVal

AddPercent

SetPercent

GetPercent

See also:

The contents of the SMWCC Custom Control Pack


TBar.AddVal
TBar.AddVal (Method)

Syntax:

procedure AddVal(Value: Real);

Description:

Adds a real value to the value of the PercentBar. That means that it add's 100*Value percent to the bar's value. If the resulting percent value is bigger than 100 / smaller than 0, the PercentBar sets the value to 100 / 0. Only if the total percent value has changed (Value>0,009) the PercentBar will be redrawed.

See also:

AddPercent

SetVal

The PercentBar


TBar.SetVal
TBar.SetVal (Method)

Syntax:

procedure SetVal(Value: Real);

Description:

Sets the argument as the value of the PercentBar. That means that it sets the bar's value to 100*Value percent. If Value is bigger than 1 / smaller than 0, the PercentBar sets the value to 100 / 0. Only if the total percent value has changed (Difference> ±0,009), the PercentBar will be redrawed.

See also:

SetPercent

GetPercent

GetVal

The PercentBar


TBar.GetVal
TBar.GetVal (Method)

Syntax:

function GetVal: Real;

Description:

Gets the value of the PercentBar.The Value will be in the range from 0 (0%) to 1 (100%)

See also:

GetPercent

The PercentBar


TBar.AddPercent
TBar.AddPercent (Method)

Syntax:

procedure AddPercent(Value: Integer);

Description:

Adds value percent to the PercentBar. If the resulting percent value is bigger than 100 / smaller than 0, the PercentBar sets the value to 100 / 0. Only if the total percent value has changed (Value<>0), the PercentBar will be redrawed.

See also:

AddVal

GetVal

GetPercent

The PercentBar


$ TBar.SetPercent
TBar.SetPercent (Method)

Syntax:

procedure SetPercent(Value: Byte);

Description:

Sets the argument as the value of the PercentBar. If Value is bigger than 100 / smaller than 0, the PercentBar sets the value to 100 / 0. Only if the total percent value has changed (Difference> ±0,009), the PercentBar will be redrawed.

See also:

SetVal

GetVal

GetPercent

The PercentBar


TBar.GetPercent
TBar.GetPercent (Method)

Syntax:

function GetPercent: Byte;

Description:

Gets the value of the PercentBar. The Value will be in the range from 0 (%) to 100 (%)

See also:

GetVal

SetVal

SetPercent

The PercentBar


The MicroScroll Control

This is a mini-scrollbar as you may have seen in some other programs such as Coreldraw or the Windows Control Center.

Normally it is used to increase or decrease the value of the corresponding edit control. But this one you can use however you want. It can be partially disabled and looks quite nice.

The code of the demo application and the import unit shows how to descend an edit control which is able to correspond with a MicroScroll.

The MicroScroll object that is described here, shows only one possibility to use this control. You can also descend your own object, but descend it from TControl. You have to write also a message procedure for the wm_MicroPressed message.

Methods:

InitResource

WMSetFocus

WMMicroPressed

See also:

The contents of the SMWCC Custom Control Pack


wm_MicroPressed
wm_MicroPressed (TMicro message)

Syntax:

fUpOrDown = wParam  /* button flag */

lParam = 0L         /* unused, has to be 0 */

Description:

The MicroScroll sends this message to itself to react if the MicroScroll was pressed.

Parameters:

fUpOrDown	a button flag to distinguish between "Up was pressed" and "Down was pressed". Can be ms_Up or ms_Down.

See also:

The MicroScroll


ms_Up
ms_Up 0x0002


ms_Down
ms_Down 0x0001


TMicro.InitResource
TMicro.InitResource (Method)

Syntax:

constructor InitResource(AParent: PWindowsObject; ResourceId: Word; AEdit: PMicroEC);

Description:

Initializes the Micro and sets Edit to AEdit. Edit is necessary for sending messages to the edit.

See also:

The MicroScroll


TMicro.WMSetFocus
TMicro.WMSetFocus (Method)

Syntax:

procedure WMSetFocus(var Msg: TMessage); virtual wm_first + wm_SetFocus;

Description:

Sets the Focus to the window Edit specifies, if it is a valid window. This is because the MicroScroll should seem to be part of the edit control.

See also:

The MicroScroll


TMicro.WMMicroPressed
TMicro.WMMicroPressed (Method)

Syntax:

procedure WMMicroPressed(var Msg: TMessage);

          virtual wm_first + wm_MicroPressed;

Description:

Sends the wm_MicroPressed message with its parameters to the window Edit specifies, if it is valid.

See also:

wm_MicroPressed

The PercentBar


The MenuButton Control

This control I knew from the Mac and from the Search dialog of WinWord 6 and because I found it useful, I implemented it here.

It is something like a button and it displays a local menu if it was pressed. In my opinion it is better to use this control instead of making a ComboBox which reacts if an item was choosen.

Like a normal menu item, the MenuButton sends a wm_Command message to it's parent with the ID of the menu item in wParam. Don't forget to check the lParamHi if the message was really send from a menu and not from an other control or from an accelerator (See the demo code for more details).

But you can also use the "normal" way and write a message procedure something like that:

procedure Item1(var Msg: TMessage);

  virtual cm_first + cm_Item1;

Methods:

AppendItem

AppendItemAndRow

AppendSeparator

See also:

Contents of the SMWCC Custom Control Pack


TMButton.AppendItem
TMButton.AppendItem (Method)

Syntax:

function AppendItem(Id: Word; NewItem: PChar): Bool;

Description:

Adds an item to the menu of the button. The result is not null if it was succesfully, it is null if it wasn't.

See also:

AppendItemAndRow

AppendSeparator

The MenuButton


TMButton.AppendItemAndRow
TMButton.AppendItemAndRow (Method)

Syntax:

function AppendItemAndRow(Id: Word; NewItem: PChar): Bool;

Description:

Does the same like AppendItem but the new item of the menu will placed in a new row. The result is not null if it was succesfully, it is null if it wasn't.

See also:

AppendItem

AppendSeparator

The MenuButton


TMButton.AppendSeparator
TMButton.AppendSeparator (Method)

Syntax:

function AppendSeparator: Bool;

Description:

Adds a separator to the menu of the button. The result is not null if it was succesfully, it is null if it wasn't.

See also:

AppendItem

AppendItemAndRow

The MenuButton


The Structo Control

This is a control what gives you the simple possibility to draw everything you want inside a dialog, and to scroll your drawing. I used it do display metafiles and to write structural charts (that's why the name Structo) in dialogs.

The use of the control is quite simple:

1.	the Structo sends a wm_MeasureItem to the parent (normally a dialog) to get the width and the height of the drawable area.
2.	everytime the Structo has to repaint it sends a wm_DrawItem message to the parent. Note that the rcItem field of the DrawItemStruct record is the full drawable area and not the rect that has to be repainted. This is because of displaying bitmaps or metafiles were you need the full rect area. If you need more help for the messages and its arguments see the help of Borland Pascal or the Windows-IDE you use.
Methods:

InitResource

SetupWindow

Paint

See also:

Contents of the SMWCC Custom Control Pack


TStructo.InitResource
TStructo.InitResource (Method)

Syntax:

constructor InitResource(AParent: PWindowsObject; ResourceId: Word);

Description:

Initializes the Structo and its Scroller and sets the styles ws_HScroll and ws_VScroll. The parameters are as usual.

See also:

The Structo Control


TStructo.SetupWindow
TStructo.SetupWindow (Method)

Syntax:

procedure SetupWindow; virtual;

Description:

Calls the inherited SetupWindow and fills a TMeasureItemStruct for sending the wm_MeasureItem message to set the values of the scroller. Do not call this method a second time!

See also:

The Structo Control


TStructo.Paint
TStructo.Paint (Method)

Syntax:

procedure Paint(PaintDC: HDC; var PaintInfo: TPaintStruct); virtual;

Description:

Fills a TDrawItemStruct and sends a wm_DrawItem message. You should not overwrite this method!

See also:

The Structo Control


How to register

The SMWCC Pack was created by:

Sebastian Modersohn Softwaredevelopment Heinestrasse 20 D 15370 Petershagen, Germany Phone: +49 33439 7462 CompuServe ID: 100340,1474

This is a shareware product. This allows you to try the software before you buy it. If after evaluating SMWCC, you decide to continue using it, you are required to register the software by remitting the registration fee of $15 to us.

To register "GO SWREG" inside CompuServe and register SMWCC with the database ID 3742.

After CompuServe has send us your User ID we will send the registered SMWCC via E-Mail as quickly as possible to you.


How to install

You can copy the files of SMWCC in every directory you want.

To install the custom controls for the Resource Workshop chosse the menu item Install Library... from the menu Options while you are editing a dialog. Then a file dialog occurs there you can select the DLL you want. Do this for all the four DLLs named on the overview of this help file.

If you want to remove a DLL/ custom control or want to copy the DLL in an other directory you'll have to change the workshop.ini file in the WINDOWS directory (you'll see how and where).

To "install" a custom control for your program you should make sure that windows will find the library file. The most simply solution is to copy the DLL-files into the WINDOWS\SYSTEM directory.

If you do not want this, copy the DLL in a directory which is in your PATH statement in autoexec.bat or give the full path string to the LoadLibrary statement in the app's Init constructor, something like that:

...

DLL:=LoadLibrary('c:\myprog\dlls\name.dll');

...

See the demo code and the BP help for more information about loading librarys.